package club.emergency.wechat.department_staff.search.consumer.service.fallback_factory;

import club.emergency.wechat.common.response.ResponseEntity;
import club.emergency.wechat.common.response.StatusCode;
import club.emergency.wechat.department_staff.search.consumer.service.DepartmentStaffSearchConsumer;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.department_staff.search.consumer.service.fallback_factory
 * Date: 2019/4/2
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@Component
public class DepartmentStaffSearchFallbackFactory implements FallbackFactory<DepartmentStaffSearchConsumer> {
    @Override
    public DepartmentStaffSearchConsumer create(Throwable throwable) {
        return new DepartmentStaffSearchConsumer() {
            @Override
            public String flipList(Long departmentId, String departmentCode, Integer pageNo, Integer pageSize) {
                return ResponseEntity.error(StatusCode.DB_SEARCH_ERROR, "查询企业人员数据失败！");
            }

            @Override
            public String signature(String openId) {
                return ResponseEntity.error(StatusCode.LOGIN_ERROR, "登录失败！");
            }

            @Override
            public String updateToken() {
                return ResponseEntity.error(StatusCode.AUTHORIZATION_FAIL, "更新token失败！");
            }
        };
    }
}
